import java.io.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.xpath.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.*;

public class MergeReports {
	public static void main(String args[]) throws Exception {
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
		DocumentBuilder builder = factory.newDocumentBuilder();
		Document doc1 = builder.parse(args[0] + "/emma/coverage.xml");
		
		TransformerFactory tranFactory = TransformerFactory.newInstance();
		Transformer aTransformer = tranFactory.newTransformer(new StreamSource(args[1] + "/mergeReports.xsl"));
		
		Source src = new DOMSource(doc1);
		Result dest = new StreamResult(new File(args[2] + "/report-summary.html"));
		aTransformer.transform(src, dest);
	}
}